<template>
  <view class="container">
    <view class="header-buttons">
      <button class="square-button" @click="goToSalesOutbound">
        <view class="button-content">
          <image class="button-image" src='../../Resources/Image/出库、换货出库 (2).png'></image>
          <text class="button-text">销售出库</text>
        </view>
      </button>
      <button class="square-button" @click="goToPurchaseInbound">
        <view class="button-content">
          <image class="button-image" src='../../Resources/Image/入库 (1).png'></image>
          <text class="button-text">采购入库</text>
        </view>
      </button>
      <button class="square-button" @click="goToOutboundOrder">
        <view class="button-content">
          <image class="button-image" src='../../Resources/Image/出库单.png'></image>
          <text class="button-text">出库记录</text>
        </view>
      </button>
      <button class="square-button" @click="goToInboundOrder">
        <view class="button-content">
          <image class="button-image" src='../../Resources/Image/warehouseReceipt.png'></image>
          <text class="button-text">入库记录</text>
        </view>
      </button>
    </view>
	
	
    <view class="data-card" @mouseover="handleMouseOver" @mouseleave="handleMouseLeave">
      <view class="card-header">
        <text>基础数据设置</text>
      </view>
      <view class="card-content">
        <button class="square-data-button" @click="goToProductManagement">
          <text class="button-text">商品管理</text>
        </button>
        <button class="square-data-button" @click="goToCategoryManagement">
          <text class="button-text">商品分类</text>
        </button>
        <button class="square-data-button" @click="goToSupplierManagement">
          <text class="button-text">供应商管理</text>
        </button>
        <button class="square-data-button" @click="goToCustomerManagement">
          <text class="button-text">客户管理</text>
        </button>
        <button class="square-data-button" @click="goToWarehouseManagement">
          <text class="button-text">仓库管理</text>
        </button>
      </view>
    </view>
	
	<view class="data-card" @mouseover="handleMouseOver" @mouseleave="handleMouseLeave" style = 'margin-top: 30px;'>
	    <view class="card-header">
	      <text>开发者专栏</text>
	    </view>
	    <view class="card-content">
	      <button class="square-data-button" @click="ToBUG">
	        <text class="button-text">BUG提交</text>
	      </button>
	    </view>
	</view>
	
  </view>
  

  
</template>

<script setup>
import { ref } from 'vue';

const hoverRef = ref(false);


//bug提交

let diaContent = '请将BUG截图与说明一并发送至开发者邮箱：tianmakeji169@gamil.com'

function ToBUG(){
	uni.showModal({
		title: "BUG提交",
		content: diaContent,
		showCancel:true
	})
}

const goToSalesOutbound = () => {
  uni.navigateTo({
    url:'/pages/OutBonds/OutBonds'
  })
};

const goToPurchaseInbound = () => {
  // router.push('/purchase-inbound');
  uni.navigateTo({
  	url:'/pages/OnBonds/OnBonds'
  })
};

const goToOutboundOrder = () => {
  // router.push('/outbound-order');
  uni.navigateTo({
  	url:'/pages/OutBindHistory/OutBindHistory'
  })
};

const goToInboundOrder = () => {
  // router.push('/inbound-order');
  uni.navigateTo({
  	url:'/pages/OnBindHistory/OnBindHistory'
  })
};

const goToProductManagement = () => {
  uni.navigateTo({
    url:'/pages/GoodsManager/GoodsManager'
  })
};

const goToCategoryManagement = () => {
  // router.push('/category-management');
  uni.navigateTo({
  	url:'/pages/Category/Category'
  })
};

const goToSupplierManagement = () => {
  // router.push('/supplier-management');
  uni.navigateTo({
  	url:'/pages/Supplier/Supplier'
  })
};

const goToCustomerManagement = () => {
  // router.push('/customer-management');
  uni.navigateTo({
  	url:'/pages/Customer/Customer'
  })
};

const goToWarehouseManagement = () => {
  // router.push('/warehouse-management');
  uni.navigateTo({
  	url:'/pages/WareHouse/WareHouse'
  })
};

const handleMouseOver = () => {
  hoverRef.value = true;
};

const handleMouseLeave = () => {
  hoverRef.value = false;
};
</script>

<style scoped>
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: start;
  height: 100vh;
  background-color: #f0f4f8;
  padding: 20px;
}

.button-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.button-image {
  width: 40px; /* 根据需要调整图片大小 */
  height: 40px; /* 根据需要调整图片大小 */
  margin-bottom: 5px; /* 根据需要调整图片与文字之间的间距 */
}

.header-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
}

.square-button {
  width: 75px;
  height: 75px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background-color: #4b7bec;
  color: white;
  border-radius: 15px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.button-text {
  color: white;
  font-size: 10px;
}

.square-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.5s ease;
  z-index: 1;
}

.square-button::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.3);
  transform: skew(-20deg);
  transition: transform 0.5s ease;
  z-index: 1;
}

.square-button:hover::before {
  transform: translate(-50%, -50%) scale(1);
}

.square-button:hover::after {
  transform: skew(-20deg) scale(1);
}

.square-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.data-card {
  width: 100%;
  max-width: 400px;
  background-color: #ffffff;
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  z-index: 2;
}

.data-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.card-header {
  padding: 20px;
  background-color: #4b7bec;
  color: white;
  font-weight: bold;
  border-radius: 15px 15px 0 0;
}

.card-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 一排三个按钮 */
  gap: 10px;
  padding: 20px;
}

.square-data-button {
  width: 73px; /* 调整按钮宽度 */
  height: 73px; /* 调整按钮高度 */
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background-color: #4b7bec;
  color: white;
  border-radius: 15px;
  font-size: 13px; /* 调整字体大小 */
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.square-data-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.5s ease;
  z-index: 1;
}

.square-data-button::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.3);
  transform: skew(-20deg);
  transition: transform 0.5s ease;
  z-index: 1;
}

.square-data-button:hover::before {
  transform: translate(-50%, -50%) scale(1);
}

.square-data-button:hover::after {
  transform: skew(-20deg) scale(1);
}

.square-data-button:active {
transform: translateY(2px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
</style>